D:\a\scloud-dns\scloud-dns\src\threads\windows\mod.rs
Line | Count | Source |
1 | | pub(crate) mod priority; |
2 | | |
3 | | pub(crate) mod imp { |
4 | | use super::super::SpawnConfig; |
5 | | |
6 | 0 | pub(crate) fn new<F, T>(cfg: SpawnConfig<'_>, f: F) -> std::thread::JoinHandle<T> |
7 | 0 | where |
8 | 0 | F: FnOnce() -> T + Send + 'static, |
9 | 0 | T: Send + 'static, |
10 | | { |
11 | 0 | let mut b = std::thread::Builder::new(); |
12 | 0 | if let Some(name) = cfg.name { |
13 | 0 | b = b.name(name.to_string()); |
14 | 0 | } |
15 | 0 | if let Some(sz) = cfg.stack_size { |
16 | 0 | b = b.stack_size(sz); |
17 | 0 | } |
18 | | |
19 | 0 | b.spawn(f).expect("failed to spawn thread") |
20 | 0 | } |
21 | | } |